<?php

//Yii::import('backend.modules.auth.AuthModule');
Yii::import('common.components.EAuthWebUser');

class AuthWebUser extends CWebUser
{
    public function getIsSuperUser()
    {
        return Yii::app()->getModule('auth')->getIsSuperUser();
    }
    
    public function checkAccess($operation, $params = array(), $allowCaching = true)
    {
        //always allows if he(she) is a super user
        if($this->getIsSuperUser())
            return true;
        else
            return parent::checkAccess($operation, $params, $allowCaching);
    }
    
    public function afterLogout()
    {
        //make sure to set the value of entryLogined to false.
        AuthModule::setEntryLogined(false);
        parent::afterLogout();
    }
    
    /**
     * @todo just in order to be compatible with frondend WebUser
     */
    public function logAdminUserAction(){}
}